package com.yidu.boss.sys.service.impl;

import com.yidu.boss.sys.dao.UserMapper;

import com.yidu.boss.sys.domain.User;
import com.yidu.boss.sys.domain.UserExample;
import com.yidu.boss.sys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> selectByExample(UserExample example) {
        return userMapper.selectByExample(example);
    }

    /**
     * 用于登录
     * @param userName 用户名
     * @return
     */
    @Override
    public User doLogin(String userName) {
        UserExample userExample = new UserExample();
        userExample.or().andUserNameEqualTo(userName);
        List<User> users = userMapper.selectByExample(userExample);
        User user=null;
        for (User user1 : users) {
            user=user1;
        }
        return user;
    }


}
